package com.ly.controller;

import com.ly.entity.Score;
import com.ly.pojo.vo.ActivityVO;
import com.ly.service.SocreService;
import com.ly.utils.ExcludeToken;
import com.ly.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author : 黑渊白花
 * @ClassName ScoreController
 * @date : 2025/5/11 16:43
 * @Description
 */
@CrossOrigin //解决跨域问题
@RestController
@RequestMapping("/score")
@Slf4j
public class ScoreController {
    @Autowired
    private SocreService socreService;

    @GetMapping("/recommend/{stuId}")
    @ExcludeToken
    public Result recommend(@PathVariable Integer stuId){
        List<ActivityVO> recommend = socreService.recommend(stuId);
        return Result.success(recommend);
    }

    //通过id得到用户
    @PostMapping ("/recommend1")
    @ExcludeToken
    public Result recommend1(@RequestBody Score score){
        log.info("{}",score);
        List<ActivityVO> recommend = socreService.recommendOther1(score);
        return Result.success(recommend);
    }

    @GetMapping("/recommendUser/{stuId}")
    @ExcludeToken
    public Result recommendUser(@PathVariable Integer stuId){
        List<ActivityVO> recommend = socreService.recommendUser(stuId);
        return Result.success(recommend);
    }

    @GetMapping("/recommendItem/{stuId}")
    @ExcludeToken
    public Result recommendItem(@PathVariable Integer stuId){
        List<ActivityVO> recommend = socreService.recommendItem(stuId);
        return Result.success(recommend);
    }

    //该学生是否已经评价该活动,评价过则返回，未评价则为0
    @GetMapping("/isPointThisAct")
    @ExcludeToken
    public Result isPointThisAct( Score score){
        return socreService.isPointThisAct(score);
    }

    @PostMapping("/evaluation")
    public Result evaluation(@RequestBody Score score){
        return socreService.evaluation(score);
    }



}
